<template>
  <router-view v-slot="{ Component, route }">
    <keep-alive v-if="keepAlive">
      <component :is="Component" :key="route.name ?? route.path" />
    </keep-alive>
    <component v-else :is="Component" :key="route.name ?? route.path" />
  </router-view>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'LayoutRouteView',
  props: {
    keepAlive: {
      type: Boolean,
      default: false
    }
  }
})
</script>
